<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="/temp/default/js/jquery-3.1.0.min.js"></script>
    <script src="/temp/default/js/flexible.debug.js"></script>
    <script src="/temp/default/js/flexible_css.debug.js"></script>
    <link rel="stylesheet" href="/temp/default/css/redPack.css">
    <title>福利大抽奖</title>
</head>
<body>
    <div class="container">
        <form method="post" action="index.php">
        <img src="/temp/default/image/code.jpg" alt="" class="logo" />
        <input type="hidden" id="userid" name="userid" value="{$userid}">
            <input type="hidden" name="action" value="order">
        <div class="money-box">
            选择金额(元)
        </div>
        <ul class="choose" id="choose">
            <li class="item" value=1.08>￥1.08</li>
            <li class="item" value="1.28">￥1.28</li>
            <li class="item" value="1.38">￥1.38</li>
            <li class="item" value="1.88">￥1.88</li>
        </ul>
            <input type="hidden" name="cost" value="" id="cost">
        <textarea cols="30" rows="5" placeholder="说点什么..." class="desc" id="description"></textarea>
        <input type="submit" value="塞进红包" class="send" onclick="send()"/>
        <input type="button" value="发送记录" class="record" onclick="javascript:;location.href='index.php?action=record&userid={$userid}'"/>
        <!-- <footer>
            <p class="infer">娱乐有度 勿侵隐私</p>
            <p class="anounce">技术支持 @ 拼多多红包技术团队</p>
        </footer> -->
        </form>
    </div>
    <script>
        $('#choose').click(function(event){
            reset();
            $(event.target).addClass('selected');
            $(this).attr('value',$(event.target).text().split('￥')[1]);
            $('#cost').val($(event.target).text().split('￥')[1]);
        });
        function reset(){
            var list = $('#choose').find('li');
            for ( var i = 0; i < list.length; i++) {
                $(list[i])[0].className = 'item';
            }
        }
        function send(){
            var price = Number($('#choose').attr('value'));
            var desc = $('#description').val();
            var userid = $('#userid').val();
            if(!price){
                alert("红包金额不能为空！");
                return false;
            }
        }
    </script>
</body>
</html>